<template>
	<view>
		<view class="Topbg">
			<u-tabs :list="nav" :current="current" @change="change" active-color="#fff" inactive-color="#fff"
				bg-color="none"></u-tabs>
		</view>
		
		<goods :list="list" v-if="list.length">
			<template v-slot:btn="{item}">
				<view class="u-flex u-row-between u-margin-top-20"> 
					<view style="color: #FF5D39;">￥{{item.totalMoney}}</view>
					<u-button size="mini" shape="circle" type="primary" @click="go(item)">详情</u-button>
				</view>
			</template>
		</goods>
		
		<u-loadmore :status="initial.status" v-if="list.length" />
		
		<view class="empty" v-else>
				<u-empty text="暂无订单" mode="order"></u-empty>
		</view>


	</view>
</template>

<script>
	import loader from '@/common/loadPage.js';
	import goods from './components/goods.vue';
	export default {
		components:{
			goods
		},
		mixins: [loader],
		data() {
			return {
				nav: [{
	                 name: '全部',
					 state:''
				},{
	                 name: '待支付',
					 state:1
				},{
	                 name: '待发货',
					 state:3
				},{
	                 name: '待收货',
					 state:4
				},{
	                 name: '售后',
					 state:7
				},{
	                 name: '已完成',
					 state:5
				}],
				current: 0,
				list: [],
				initial: {
					geturl: "/indent/orderList",
					parm: {
					  state:'',
					  order_type:'1,2,3,4'
					},
					isPage: true
				},
				banShare:true
						
			}
		},
		onShow() {
			this.initial.page=1;
			this.getGoods()
					
		},
		methods:{
			go(item){
				uni.navigateTo({
					url:"./detail?id="+item.id
				})
			},
			change(e){
				this.current=e;
				this.initial.page=1;
				this.initial.parm.state=this.nav[this.current].state;
				this.getGoods()
			}
		}
	}
</script>

<style>
	.Topbg {
		
		background: #4066F4;
		display: inline-block;
		width: 750rpx;
		padding: 20rpx;

	}
</style>
